﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace DoAn
{
    public partial class FormDangNhap : Form
    {
        public FormDangNhap()
        {
            InitializeComponent();
        }

        private void btnMatkhau_Click(object sender, EventArgs e)
        {
            // B1 : tao xml document, load noi dung tu tap tin xml
            XmlDocument MatKhauDoc = new XmlDocument();
            MatKhauDoc.Load("../../MatKhau.xml");
            // B2 : tao the goc root
            XmlElement MatKhau = MatKhauDoc.DocumentElement;
            // B3 : lay gia tri trong cac attribute cua root
            int mk = Convert.ToInt32(MatKhau.GetAttribute("text"));
            if (txtMatkhau.Text == mk.ToString())
            {
                this.Visible = false;
                FormTaoDe frmtaode = new FormTaoDe();
                frmtaode.ShowDialog();
            }
            else
            {
                DialogResult dr = MessageBox.Show("Mật khẩu không đúng", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }  
        }
    }
}